package com.doit.day04

import com.doit.day03.Pers

import scala.collection.mutable

//key   value 结构的map
object _02_Map {
  def main(args: Array[String]): Unit = {


    //不可变集合
    val map: Map[String, Int] = Map("zss" -> 18, "lss" -> 29)

    val map1: Map[String, Pers] = Map(("mingge", Pers("zss",18,"male")), ("feige", Pers("zss",18,"male")), ("chujiejie", Pers("zss",18,"male")), ("yujiejie", Pers("zss",18,"male")))
    println(map1.size)

    val maybePers: Option[Pers] = map1.get("feige")
    if(!maybePers.isEmpty){
      val value: Pers = maybePers.get
      println(value)
    }

    val pers: Pers = map1.getOrElse("feige", Pers("lss", 19, "female"))

    val map2: mutable.Map[String, Int] = mutable.Map[String, Int]()
   //    map2.put()


  }

}
